package com.amazon.jobtest;

import java.io.File;
import java.util.List;

import com.amazon.jobtest.util.CsvUtil;

public class Main {
	public static void main(String[] args) {
		//the file path parameter should be passed
		if(args.length == 0){
			System.out.println("Usage: testAmazon.jar [cvsFilePath]");
			System.exit(0);
		}
		
		String csvName = args[0];
		
		File csvFile = new File(csvName);
		if(!csvFile.exists()){
			System.out.println("Invalid cvs file path!");
			System.exit(0);
		}
		//transforms the Csv file into an object list to be easier to manipulate
		List<Student> studentList = CsvUtil.readCsv(csvFile);
		//iterates over the list of students and show into the standard output
		//TODO investigate about how this information must be shown
		for(Student student : studentList){
			System.out.println("Student ID: " + student.getStudentId());
			System.out.println("\nStudent average: " + student.getAverageTestResult());
			System.out.println("\n\n ----------------------------\n\n");
		}
	}
}
